package com.john.permission.web;

import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@Slf4j
//@ControllerAdvice(basePackages = "com.john.permission.web", annotations = {Controller.class})
public class GlobalControllerAdvice {

//    @ExceptionHandler(Throwable.class)
    public ResponseEntity<String> globalExceptionHandler(Throwable throwable) {
        log.error("服务器出错, ", throwable);
        return ResponseEntity.status(500).body("服务器出错了, " + throwable);

    }

}
